<?php
namespace app\controllers;

use Yii;
use yii\filters\AccessControl;
use yii\web\Controller;
use yii\web\Response;
use common\models\LoginForm;
use yii\filters\VerbFilter;

class DocController extends BaseController
{
    public $sideNav = "nav-accounts";
    public $subNav = "";
    public $pageTitle = "";

    public function actions() {
        return [
            'error' => [
                'class' => 'yii\web\ErrorAction',
            ],
        ];
    }

    public function init() {
        parent::init();
    }

    public function actionAjaxResponse() {
        $response = Yii::$app->response;
        $response->format = Response::FORMAT_JSON;
        $response->data = [
            'status' => 'success',
            'message' => 'Action done!'
        ];
        return $response;
    }

    public function actionPrivacy() {
        $this->layout = "doc";
        $this->pageTitle = $this->t('doc', 'Privicy Policy');
        $doc = 'privacyDoc';
        \Yii::$app->language == 'en-US' && $doc = 'privacyDocEN';
        return $this->render($doc, [
            'sideNav' => $this->sideNav,
            'subNav' => $this->subNav,
            'pageTitle' => $this->pageTitle
        ]);
    }
}//eof
